home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00413_Speech Hyperlink Management.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  3.0 KB  |  106 lines

  1. global oASRObj, gMainLangModel, gCallBack, gSelectorLangModel, gTempLangModel, gMainLexSize, gMainLex, gMACListenStatus, gTempLexSize, gTempLexicon, gInputField, gdescfield, gIndxScrollFldK, gComputerTypeK, gVideoButtspr, gSelectorLex, gSelectorLexSize, gHuhCount, gESstartSND, oTextScroller, oIndexScroller, oINTERfaceFind, gPrevCommand, gBtnHitSND, gQTflag, gModeState, gTrekCursor, gSpeeButtSpr, gSpeeButtCastList, gWINListenStatus, gWinVoiceEnabled, gAudioButtspr, gWINvoiUserPermit, gSpeechCapable, gTempHyperlinks, gHoldSearchInfo, gResrcButtspr, oTextSlider
  2.  
  3. on hPrepTempLang pLM, pSize, pList
  4.   cursor(4)
  5.   set Lerrmsg to 0
  6.   set tidl to the itemDelimiter
  7.   set the itemDelimiter to "@"
  8.   if not voidp(gTempHyperlinks) then
  9.     set LitmCnt to the number of items in gTempHyperlinks
  10.   else
  11.     return 
  12.   end if
  13.   if LitmCnt = 1 then
  14.     set LitmCnt to 0
  15.   end if
  16.   repeat with i = 1 to pSize
  17.     set Lerrmsg to oASRObj(mAddPhrase, pLM, getAt(pList, i), i + LitmCnt)
  18.     if Lerrmsg then
  19.       exit repeat
  20.     end if
  21.     put getAt(pList, i) after item i + LitmCnt of gTempHyperlinks
  22.   end repeat
  23.   set the itemDelimiter to tidl
  24.   cursor([gTrekCursor, gTrekCursor + 1])
  25.   if Lerrmsg then
  26.   end if
  27. end
  28.  
  29. on hAppendLexiconfromList pTheList
  30.   if not objectp(pTheList) then
  31.     return 
  32.   end if
  33.   set Lcnt to count(pTheList)
  34.   repeat with i = 1 to Lcnt
  35.     add(gTempLexicon, getPropAt(pTheList, i))
  36.   end repeat
  37. end
  38.  
  39. on hAppendLexicon W1, wLast
  40.   set Lchunk to word W1 to wLast of field gdescfield
  41.   if Lchunk contains ";" then
  42.     set Ltidl to the itemDelimiter
  43.     set the itemDelimiter to ";"
  44.     set Lsz to the number of items in Lchunk
  45.     repeat with i = 1 to Lsz
  46.       add(gTempLexicon, item i of Lchunk)
  47.     end repeat
  48.     set the itemDelimiter to Ltidl
  49.   else
  50.     add(gTempLexicon, Lchunk)
  51.   end if
  52. end
  53.  
  54. on hAppendLinkstoLanguage
  55.   set Ltempsz to count(gTempLexicon)
  56.   hPrepTempLang(gTempLangModel, Ltempsz, gTempLexicon)
  57.   set gTempLexicon to []
  58. end
  59.  
  60. on hPrepTempLexicon
  61.   hLoadIndextoLexicon()
  62. end
  63.  
  64. on hLoadIndextoLexicon
  65.   set n to 1
  66.   repeat while 1
  67.     set Lw to line n of field gIndxScrollFldK
  68.     if Lw = EMPTY then
  69.       exit repeat
  70.     end if
  71.     add(gTempLexicon, Lw)
  72.     set n to n + 1
  73.     if n = 8 then
  74.       exit repeat
  75.     end if
  76.   end repeat
  77.   hAddLinkstoLanguage()
  78.   set gTempLexicon to []
  79. end
  80.  
  81. on hAddLinkstoLanguage
  82.   if objectp(oASRObj) and (gMACListenStatus = 1) and (gTempLangModel <> 0) then
  83.     hReportStatus("Updating speech recognizers...")
  84.     if not objectp(gTempLexicon) then
  85.       set Ltempsz to -1
  86.     else
  87.       set Ltempsz to count(gTempLexicon)
  88.     end if
  89.     if Ltempsz < 1 then
  90.       return 
  91.     end if
  92.     oASRObj(mClearLanguage, gTempLangModel)
  93.     set gTempHyperlinks to EMPTY
  94.     hPrepTempLang(gTempLangModel, Ltempsz, gTempLexicon)
  95.     hReportStatus("Recognizers updated...")
  96.   else
  97.   end if
  98. end
  99.  
  100. on hUploadTempLinksLang
  101.   if objectp(oASRObj) then
  102.     set gTempLangModel to oASRObj(mNewLanguage, "<TempLinks>")
  103.     hPrepALanguage(gTempLangModel, 1, ["hello computer": "hReply #hello"])
  104.   end if
  105. end
  106.